//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.restaurant.application.configintegral;

import com.google.common.base.Strings;
import com.nebutown.base.ViewSpec;
import com.nebutown.base.data.View;
import com.nebutown.base.data.ViewUpdate;
import com.nebutown.commonunits.dataface.DataModes;
import com.nebutown.commonunits.dataface.FormShell;
import com.nebutown.commonunits.dataface.definitions.PageForm;
import com.nebutown.commonunits.uidataface.UIDataFace;
import com.nebutown.generation.basicdata.StringMap;
import com.restaurant.application.configintegral.support.AbstractConfigIntegral;
import com.restaurant.application.configintegral.support.ConfigIntegralData;
import java.util.List;

public class ConfigIntegralImpl extends AbstractConfigIntegral {
    public ConfigIntegralImpl() {
    }

    public ViewUpdate save(ConfigIntegralData save, int[] seq) {
        this.setData(save);
        return this.returnViewCall(this.buildViewCall(this.unitPosition(), "showErrorMessage", (List)null, (new StringMap()).putData("errorMessage", "设置成功")));
    }

    public View getFullView() {
        PageForm pageForm = this.newFormShell(this.getData().duplicate()).getForm();
        return ((UIDataFace)this.getSingleton(UIDataFace.class)).newUniForm(this.unitPosition(), pageForm);
    }

    public View getViewLead(ViewSpec spec) {
        return null;
    }

    private FormShell newFormShell(ConfigIntegralData data) {
        FormShell formShell = new FormShell("设置/积分细则设置", 2, 1);
        formShell.source(data, DataModes.VALIDATE);
        formShell.at(0, 0, "积分细则").styles("", "height:260px;width:230").imageentryField("detail", data.getDetail()).placeHolder("积分细则设置").setEditable(true);
        if (!Strings.isNullOrEmpty(this.getPath(CMD_SAVE, new int[0]))) {
            formShell.at(1, 0, "").buttonField(this.getPath(CMD_SAVE, new int[0]), "设置", "", true);
        }

        return formShell;
    }

    public String findDetail() {
        return this.getData().getDetail();
    }
}
